package com.fenghuo.map;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.fenghuo.utils.Values;


public class Ac_Search extends Activity implements OnClickListener {

    private AutoCompleteTextView at_search;
    private Button btn_search;
    private TextView tv_yundongchang;
    private TextView tv_youyongguan;
    private TextView tv_tiyuguan;
    private TextView tv_jinghu;
    private TextView tv_tushuguan;
    private TextView tv_back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ac_search);

        at_search = (AutoCompleteTextView) findViewById(R.id.at_search_txt);
        btn_search = (Button) findViewById(R.id.btn_search);
        tv_jinghu = (TextView) findViewById(R.id.tv_search_jinghu);
        tv_tiyuguan = (TextView) findViewById(R.id.tv_search_tiyuguan);
        tv_yundongchang = (TextView) findViewById(R.id.tv_search_yundongc);
        tv_youyongguan = (TextView) findViewById(R.id.tv_search_youyong);
        tv_tushuguan = (TextView) findViewById(R.id.tv_search_tushu);
        tv_back = (TextView) findViewById(R.id.tv_back_search);

        btn_search.setOnClickListener(this);
        tv_back.setOnClickListener(this);
        tv_jinghu.setOnClickListener(this);
        tv_yundongchang.setOnClickListener(this);
        tv_tiyuguan.setOnClickListener(this);
        tv_tushuguan.setOnClickListener(this);
        tv_youyongguan.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        String str = "";
        switch (v.getId()) {
            case R.id.tv_back_search:
                finish();
                break;
            case R.id.tv_search_jinghu:
                str = "镜湖";
                break;
            case R.id.tv_search_tiyuguan:
                str = "体育管";
                break;
            case R.id.tv_search_tushu:
                str = "图书管";
                break;
            case R.id.tv_search_youyong:
                str = "游泳管";
                break;
            case R.id.tv_search_yundongc:
                str = "运动场";
                break;
            case R.id.btn_search:
                str = at_search.getText().toString();
                if (str.trim().equals("")) {
                    Toast.makeText(Ac_Search.this, "请输入搜索内容!", Toast.LENGTH_SHORT).show();
                    return;
                }
                break;
            default:
                break;
        }
        Values.searchstrString = str;
        finish();
    }

}
